import axios from 'axios'

export default {
    /**
     * 获取列表数据
     * @param params
     * @returns {AxiosPromise<any>}
     */
    fetch (params) {
        return axios.get('an/service/station', {
            params: params
        });
    },
    /**
     * 根据id获取详情
     */
    fetchById(id){
        return axios.get(`an/service/station/${id}`,);
    },
    /**
     * 创建用户
     * @param params
     * @returns {AxiosPromise<any>}
     */
    create(params){
        return axios.post('an/service/station',params);
    },
    /**
     * 删除用户
     * @param id
     * @returns {AxiosPromise<any>}
     */
    destroy(id){
        return axios.delete(`an/service/station/${id}`);
    },
    /**
     * 修改用户
     * @param id
     * @param params
     * @returns {AxiosPromise<any>}
     */
    update(id,params){
        return axios.patch(`an/service/station/${id}`, params);
    },

    /**
     * 获取关键字关联地址
     */
    search(params){
        return axios.post(`an/service/station/search`, params);
    },

    /**
     * 获取关联网点列表
     */
    network(params){
        return axios.post(`an/service/station/relation`,params);
    },

    /**
     * 获取子站点列表
     */
    child(params){
        return axios.post(`an/service/station/service`,params);
    },

    /**
     * 重置密码
     */
    resetPwd(params){
        return axios.post(`an/service/station/password`,params);
    },

    /**
     * 解除关联网点
     */
    unbindNetwork(id){
       return axios.post(`an/service/station/relieve`,{id:id})
    },
}
